package com.e9ab98e991ab.moduler.ui.vivo

import android.content.Intent
import android.text.TextUtils
import android.view.View


import com.e9ab98e991ab.libcommon.base.BaseActivity
import com.e9ab98e991ab.moduler.R

import com.e9ab98e991ab.libcommon.utils.SPSingleData
import com.e9ab98e991ab.libcommon.utils.toast.ToastyUtils
import kotlinx.android.synthetic.main.activity_autoclick_vivo.*

class VivoInstallationPasswordActivity : BaseActivity() {


    override fun getLayoutId(): Int {
        return R.layout.activity_autoclick_vivo
    }



    override fun initSet() {
        setTitle(R.string.automatically_password)




        val password = SPSingleData.getObjectForKey(applicationContext, InstallHelperService.KEY_PASSWORD, "") as String

        if (!TextUtils.isEmpty(password)) {
            et_password.setText(password)
            et_password.setSelection(password.length)
        }
    }

    override fun initDate() {
        button.setOnClickListener {
            val password = et_password.text.toString().trim { it <= ' ' }
            SPSingleData.setObject(this, InstallHelperService.KEY_PASSWORD, password)
            ToastyUtils.normal( R.string.autoclick_vivo_save_success)
        }

        button2.setOnClickListener {
            startActivity(Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS))
        }
    }


}
